<?php
$roles = $data['roles'];
$user = $data['user'];
?>
<div class="block">

    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        <h2>Phân quyền cho user: <strong style="color: red;"><?php echo $user['email']; ?></strong></h2>
    </div>

    <div class="block_content">
        <?php echo showMessage(); ?>
        <form action="" method="post">            
            <p>
                <label>Email:</label><br />
                <input type="text" class="text small" name="email" <?php if(!empty($user) && $this->action->id == 'edit') echo 'readonly=""'; ?> value="<?php echo str2str($user['email']); ?>" />
            </p>

            <p>
                <label>Password:</label><br />
                <input type="password" class="text small" name="password" value="" />
            </p>

            <p>
                <label>Re-password:</label><br />
                <input type="password" class="text small" name="re_password" value="" />
            </p>

            <p>

                <label>Roles:</label><br />
                <?php
                if (!empty($roles)) {
                    
                }
                foreach ($roles as $item) {
                    ?>                
                <input <?php if(in_array($item->id, $data['user_role'])) echo 'checked=""'; ?> type="checkbox" name="role[]" class="checkbox" id="role_<?php echo $item->id; ?>" value="<?php echo $item->id; ?>" /> 
                    <label style="font-weight: normal;" for="role_<?php echo $item->id; ?>"><?php echo $item->role; ?></label><br />
                    <?php
                }
                ?>
            </p>
            <p><label>Status:</label><br />
                <select name="status" class="styled">
                    <option value="1" selected="">Active</option>
                    <option value="0" <?php if (!empty($user) && $user['status'] == 0) echo 'selected=""'; ?>>Unactive</option>
                </select>
            </p>
            <hr />

            <p>
                <input type="submit" class="submit small" value="Submit" />
            </p>
        </form>


    </div>		<!-- .block_content ends -->

    <div class="bendl"></div>
    <div class="bendr"></div>

</div>